package com.kgc.cgapi.pojo;


import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.kgc.basic.annotation.DetailEntity;
import com.kgc.basic.annotation.PdfFieldMapping;
import com.kgc.basic.annotation.PdfTemplateConfig;
import com.kgc.basic.annotation.Validation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

//@Data
//@NoArgsConstructor
//@AllArgsConstructor
//@ToString
@PdfTemplateConfig(templatePath = "${pdf.template.path}")
public class PurchaseInvoice implements Serializable {

    @ExcelIgnore
    private Integer id;

    @ExcelProperty("采购发票单据编号")
    @Validation(required = true, message = "采购发票单据编号不能为空")
    @PdfFieldMapping(templateField = "code")
    private String code;

    @ExcelIgnore
    @PdfFieldMapping(templateField = "codeDate", format = "yyyy/MM/dd HH:mm:ss")
    private Date codeDate;

    @ExcelProperty("发票类型id")
    private Integer invoiceType;

    @ExcelProperty("发票类型")
    @Validation(required = true, message = "发票类型不能为空")
    private String invoice_type;

    @ExcelProperty("供应商id")
    private Integer supplierId;

    @ExcelProperty("供应商名称")
    @Validation(required = true, message = "供应商名称不能为空")
    @PdfFieldMapping(templateField = "supplierName")
    private String supplierName;

    @ExcelProperty("发票号")
    @Validation(required = true, message = "发票号不能为空")
    private String invoiceNum;

    @ExcelProperty("发票状态id")
    @Validation(required = true, regex = "^[0123]+$", message = "0.已作废 1.未审核 2.未执行 3.已执行")
    private Integer codeState;

    @ExcelProperty("发票状态")
    private String code_state;

    @ExcelProperty("源单号")
    @Validation(required = true, message = "源单号不能为空")
    private String originalOrderNum;

    @ExcelProperty("金额")
    @Validation(required = true, regex = "^[0-9]+\\\\.?[0-9]*$", message = "金额只能为数字")
    private BigDecimal amount;

    @ExcelIgnore
    private Date orderCreationTime;

    @ExcelIgnore
    @PdfFieldMapping(templateField = "orderCreator")
    private String orderCreator;

    @ExcelIgnore
    private String orderDepartment;

    @ExcelIgnore
    private Date modifyTime;

    @ExcelIgnore
    private String modifier;

    @ExcelIgnore
    private Integer isDelete;

//    private String name;

    @ExcelIgnore
    @DetailEntity(detailClass = PurchaseInvoiceDetail.class, relationField = "invoiceCode")
    private List<PurchaseInvoiceDetail> details;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Date getCodeDate() {
        return codeDate;
    }

    public void setCodeDate(Date codeDate) {
        this.codeDate = codeDate;
    }

    public Integer getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(Integer invoiceType) {
        this.invoiceType = invoiceType;
    }

    public String getInvoice_type() {
        return invoice_type;
    }

    public void setInvoice_type(String invoice_type) {
        this.invoice_type = invoice_type;
    }

    public Integer getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Integer supplierId) {
        this.supplierId = supplierId;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getInvoiceNum() {
        return invoiceNum;
    }

    public void setInvoiceNum(String invoiceNum) {
        this.invoiceNum = invoiceNum;
    }

    public Integer getCodeState() {
        return codeState;
    }

    public void setCodeState(Integer codeState) {
        this.codeState = codeState;
    }

    public String getCode_state() {
        return code_state;
    }

    public void setCode_state(String code_state) {
        this.code_state = code_state;
    }

    public String getOriginalOrderNum() {
        return originalOrderNum;
    }

    public void setOriginalOrderNum(String originalOrderNum) {
        this.originalOrderNum = originalOrderNum;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getOrderCreationTime() {
        return orderCreationTime;
    }

    public void setOrderCreationTime(Date orderCreationTime) {
        this.orderCreationTime = orderCreationTime;
    }

    public String getOrderCreator() {
        return orderCreator;
    }

    public void setOrderCreator(String orderCreator) {
        this.orderCreator = orderCreator;
    }

    public String getOrderDepartment() {
        return orderDepartment;
    }

    public void setOrderDepartment(String orderDepartment) {
        this.orderDepartment = orderDepartment;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public List<PurchaseInvoiceDetail> getDetails() {
        return details;
    }

    public void setDetails(List<PurchaseInvoiceDetail> details) {
        this.details = details;
    }

}
